<?php

namespace App\Models\User;

use App\Models\Posts\WxPostsVote;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

class WxUserVote extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'wx_user_vote';

    public function user()
    {
        return $this->hasOne(WxUser::class, 'id', 'user_id');
    }

    public function getVoteTitleAttribute(){
        return WxPostsVote::where('id', $this->vote_id)->value('option'.$this->vote_option);
    }

}
